package com.tools.developer.bean;

import java.io.Serializable;
import java.util.Comparator;

import android.graphics.drawable.Drawable;

public class DataBaseModel implements Serializable {
	private static final long serialVersionUID = -6665713355081465148L;
	private int id;
	private String packageName;
	private String mVer;

	public String getmVer() {
		return mVer;
	}

	public void setmVer(String mVer) {
		this.mVer = mVer;
	}

	private String appId;
	private String name;
	private Drawable icon;
	public boolean isSystemApp;
	private long count = -1;
	private long size;
	private int storage;
	private double memUsage;
	private String publicSourceDir;
	private String dataDir;
	private boolean checked;
	public int pid;
	public String mShareUid;

	public void setDataDir(String dataDir) {
		this.dataDir = dataDir;
	}

	public String getDataDir() {
		return dataDir;
	}

	public String getPublicSourceDir() {
		return publicSourceDir;
	}

	public void setPublicSourceDir(String publicSourceDir) {
		this.publicSourceDir = publicSourceDir;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public int getStorage() {
		return storage;
	}

	public void setStorage(int storage) {
		this.storage = storage;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}

	public Drawable getIcon() {
		return icon;
	}

	public void setIcon(Drawable icon) {
		this.icon = icon;
	}

	public boolean isSystemApp() {
		return isSystemApp;
	}

	public void setSystemApp(boolean isSystemApp) {
		this.isSystemApp = isSystemApp;
	}

	public boolean getChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public double getMemUsage() {
		return memUsage;
	}

	public void setMemUsage(double memUsage) {
		this.memUsage = memUsage;
	}

	public static Comparator<DataBaseModel> SORT_APP = new Comparator<DataBaseModel>() {

		@Override
		public int compare(DataBaseModel object1, DataBaseModel object2) {
			// TODO Auto-generated method stub
			if (object1.getChecked() != object2.getChecked()) {
				return (object1.getChecked() ? -1 : 1);
			}
			double diff = object2.memUsage - object1.memUsage;
			if (object1.getChecked() == object2.getChecked()) {
				if (diff > 0) {
					return 1;
				} else if (diff < 0) {
					return -1;
				} else {
					return 0;
				}
			}
			return 1;
		}

	};
}
